#include <stdio.h>

int rn(int y) {
    if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0)) {
        return 1;  
    } else {
        return 0;  
    }
}

int main() {
    int y, m, d;
    
    scanf("%d-%d-%d", &y, &m, &d);
    
    int ds[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    
    if (rn(y)) {
        ds[1] = 29; 
    }

    int dd = 0;
    
    for (int i = 0; i < m - 1; i++) {
        dd += ds[i];
    }
    
    dd += d;
    
    printf("%d\n", dd);

    return 0;
}
